<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .item {
            margin-top: 10px;
            background: #77aaad;
        }

        .item .names {
            color: #aadd;
        }

        .item>.countrys {
            color: #faaadf;
        }
    </style>
</head>

<body>
    <div id="app">
        <!--1.遍历字符串 -->
        <ul>
            <li v-for="item in message">{{item}}</li>
        </ul>
        <!-- 2.遍历数组复杂数据 -->
        <h2>电影列表</h2>
        <div class="item" v-for="item in movies">
            <h3 class="names">电影名称：{{item.name}}</h3>
            <p class="countrys">所属国家：{{item.country}}</p>
        </div>
        <!-- 3.遍历对象 -->
        <ul>
            <li v-for="(value,key,index) in info">{{value}}-{{key}}-{{index}}</li>
        </ul>
        <!-- 4.遍历数字 -->
        <ul>
            <li v-for="num in 10">{{num}}</li>
        </ul>
    </div>

    <script src="https://unpkg.com/vue@next"></script>
    <script>
        //用vue创建app
        const app = Vue.createApp({
            // template: `

            // `,
            data() {
                return {
                    message: "Hello world",
                    movies: [
                        { id: 01, name: "流浪地球", country: "中国" },
                        { id: 02, name: "怦然心动", country: "美国" },
                        { id: 03, name: "请以你的名字呼唤我", country: "意大利" }
                    ],
                    info: { name: "ran", age: 18, height: 180 }
                }
            },
            methods: {

            }
        })
        //挂载app
        app.mount("#app")
    </script>

</body>

</html>